﻿@{
    ViewBag.Title = "AlterWindowSelectOrder";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    $(function () {
        gridListDetail();
    });
 
    function gridListDetail() {
        var $gridList = $("#gridListDetail");
        $gridList.jqGrid({
            url: "",
            height: 200,
            colModel: [
                        {
                            label: "单据编号", name: "F_Id", width: 120, align: 'left'
                        },
                        { label: '零件编号', name: 'F_Location', width: 100, align: 'left' },
                        { label: '零件名称', name: 'F_JsEvent', width: 160, align: 'left' },
                        { label: "来料单位名称", name: "F_ModuleId", width: 120, align: 'left' },
                        { label: '批次号', name: 'F_Split', width: 100, align: 'left' },
                        { label: '数量', name: 'F_Num', width: 100, align: 'left' }
            ],
            sortname: 'F_DepartmentId asc,F_CreatorTime desc',
            viewrecords: true,
            multiselect: true,
            onSelectRow: function (rowId) {
                var rowData = $gridList.jqGrid('getRowData', rowId);
                $.each(rowData, function (key, value) {
                    $("#" + key).val(value);
                });
            }
        });
        //默认添加空行
        for (var i = 1; i < 10; i++) {
            var rowdata = {"F_Id":"TZ000"+i,"F_Location":"LJ000"+i,"F_JsEvent":"零件000"+i,"F_ModuleId":"单位名称000"+i,"F_Split":"PCH000"+i,"F_Num":i+12};
            $gridList.jqGrid('addRowData', i, rowdata);
        };
    }
    function GetOrderData() {
        var $gridList = $("#gridListDetail");
        var ids = $gridList.jqGrid("getGridParam", "selarrrow");
        var data = [];
        $(ids).each(function (index, rowId) {
            var rowData = $gridList.jqGrid('getRowData', rowId);
            data.push(rowData);
        });
        return data;
    }
</script>
<div>
    <table class="form">
        <tr>
            <th class="formTitle">单据编号</th>
            <td class="formValue">
                <input id="F_Id" name="F_ItemName" type="text" class="form-control required" placeholder="请输入名称" />
            </td>

            <th class="formTitle">零件编号</th>
            <td class="formValue">
                <input id="F_Location" name="F_ItemCode" type="text" class="form-control required" placeholder="请输入编号" />
            </td>

            <th class="formTitle">零件名称</th>
            <td class="formValue">
                <input id="F_JsEvent" name="F_ItemCode" type="text" class="form-control required" placeholder="请输入编号" />
            </td>
        </tr>
        <tr>
            <th class="formTitle">来料单位名称</th>
            <td class="formValue">
                <input id="F_ModuleId" name="F_ItemName" type="text" class="form-control required" placeholder="请输入名称" />
            </td>

            <th class="formTitle">批次号</th>
            <td class="formValue">
                <input id="F_Split" name="F_ItemCode" type="text" class="form-control required" placeholder="请输入编号" />
            </td>

            <th class="formTitle">数量</th>
            <td class="formValue">
                <input id="F_Num" name="F_ItemCode" type="text" class="form-control required" placeholder="请输入编号" />
            </td>
        </tr>
    </table>
</div>
<hr />
<div >
    <table class="form">
        <tr>
            <th class="formTitle">领料单位</th>
            <td class="formValue">
                <input id="F_ItemName" name="F_ItemName" type="text" class="form-control required" placeholder="请输入名称" />
            </td>

            <th class="formTitle">单据日期</th>
            <td class="formValue">
                <input id="F_ItemCode" name="F_ItemCode" type="text" class="form-control required" placeholder="请输入编号" />
            </td>

            <th class="formTitle">单据日期</th>
            <td class="formValue">
                <input id="F_ItemCode" name="F_ItemCode" type="text" class="form-control required" placeholder="请输入编号" />
            </td>
            <td>
            <div class="btn-group" style="margin-right:20px;">
    <a id="" class="btn btn-primary center-block" onclick=" GetOrderData();"><span class="glyphicon glyphicon-ok"></span> 查询</a>
</div></td>
        </tr>
    </table>
</div>
<div class="gridPanel">
    <table id="gridListDetail" class="ui-jqgrid-btable"></table>
</div>